package cn.chenhuanming.shh.administer.entity.jpa;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * WebsiteDepartment entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "website_department", catalog = "house")
public class WebsiteDepartment implements java.io.Serializable {

	// Fields

	private Integer id;
	private WebsiteDepartment websiteDepartment;
	private String parentName;
	private String name;
	private String phone;
	private String address;
	private String status;
	private Set<WebsiteDepartment> websiteDepartments = new HashSet<WebsiteDepartment>(
			0);

	// Constructors

	/** default constructor */
	public WebsiteDepartment() {
	}

	/** minimal constructor */
	public WebsiteDepartment(String name, String phone, String status) {
		this.name = name;
		this.phone = phone;
		this.status = status;
	}

	/** full constructor */
	public WebsiteDepartment(WebsiteDepartment websiteDepartment,
			String parentName, String name, String phone, String address,
			String status, Set<WebsiteDepartment> websiteDepartments) {
		this.websiteDepartment = websiteDepartment;
		this.parentName = parentName;
		this.name = name;
		this.phone = phone;
		this.address = address;
		this.status = status;
		this.websiteDepartments = websiteDepartments;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "parent_id")
	public WebsiteDepartment getWebsiteDepartment() {
		return this.websiteDepartment;
	}

	public void setWebsiteDepartment(WebsiteDepartment websiteDepartment) {
		this.websiteDepartment = websiteDepartment;
	}

	@Column(name = "parent_name", length = 50)
	public String getParentName() {
		return this.parentName;
	}

	public void setParentName(String parentName) {
		this.parentName = parentName;
	}

	@Column(name = "name", nullable = false, length = 50)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "phone", nullable = false, length = 12)
	public String getPhone() {
		return this.phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	@Column(name = "address")
	public String getAddress() {
		return this.address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	@Column(name = "status", nullable = false, length = 3)
	public String getStatus() {
		return this.status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "websiteDepartment")
	public Set<WebsiteDepartment> getWebsiteDepartments() {
		return this.websiteDepartments;
	}

	public void setWebsiteDepartments(Set<WebsiteDepartment> websiteDepartments) {
		this.websiteDepartments = websiteDepartments;
	}

}